import React, { Component } from 'react'
import axios from 'axios';

/**
 * 使用该组件时，需要在 package.json 中添加 "proxy": "https://dev.usemock.com"
 */
export default class PackageProxy extends Component {
  handleFetch = () => {
    axios.get('/65d55e87c87ce4342e1285ab/todos').then(
      response => console.log('请求成功', response.data),
      error => console.error(error),
    )
  }

  render() {
    return (
      <div>
        <button onClick={this.handleFetch}>点击我发送请求</button>
      </div>
    )
  }
}
